import absanimateengine from "./absanimateengine";
class TranslateEngine extends absanimateengine.AbsAnimateEngine {
    constructor(graph) {
        super(graph);
        this.type = "translate";
    }

    animate() {
        if (!this.path) {
            return;
        }
        let result = this.path.animate(this.speed);
        let dirVct = result.dir.vector;
        let angle = dirVct.angleFrmXAxisPositiveDir();
        this.destGraph.translate2DstPt(result.pt, 1);
        let preAngle = this.destGraph.getAngle();
        if (preAngle != angle) {
            this.destGraph.setAngle(angle);
            this.destGraph.rotateCoord(this.destGraph.getZone().getCnt(), angle - preAngle);
        }
    }
}

export default { TranslateEngine }